home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / collect4output.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-12  |  3.0 KB  |  96 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. #ifndef COLLECT4OUTPUT_H
  8. #define COLLECT4OUTPUT_H
  9.  
  10. #include <QObject>
  11. #include <QMap>
  12.  
  13. class QString;
  14. class ScribusDoc;
  15. class PrefsContext;
  16. class PageItem;
  17.  
  18.  
  19. /*! \brief Performs "Collect for Output" tasks.
  20. collect() method copies the document, fonts and images
  21. into user defined directory. QObject inheritance mainly due
  22. moc speedup and tr() methods.
  23. \author Petr Vanek, Franz Schmid
  24. */
  25. class CollectForOutput : public QObject
  26. {
  27.     Q_OBJECT
  28.  
  29. public:
  30.     /*! \brief Setup the attributes
  31.     \param doc a Scribus doecument reference
  32.     \param withFontsA collect/move fonts into output directory too
  33.     \param withProfilesA collect/move CMS profiles into output directory too
  34.     \param compressDocA use gzipped document
  35.     */
  36.     CollectForOutput(ScribusDoc* doc, bool withFontsA=false, bool withProfilesA=false, bool compressDocA=false);
  37.     ~CollectForOutput(){};
  38.  
  39.     /*! \brief Main method doing everything.
  40.     It calls all related methods
  41.     */
  42.     QString collect();
  43.  
  44. private:
  45.     /*! Doc to collect */
  46.     ScribusDoc* m_Doc;
  47.     /*! Use compressed document. See the constructor */
  48.     bool compressDoc;
  49.     /*! Collect fonts too. See the constructor */
  50.     bool withFonts;
  51.     /*! Collect icc profiles too. See the constructor */
  52.     bool withProfiles;
  53.     /*! User defined directory via GUI */
  54.     QString outputDirectory;
  55.     /*! Name of the moved file with the new directory path */
  56.     QString newName;
  57.     /*! \brief Remember already collected files to collect the same files only once.
  58.     It's QMap - newFile, oldFile.*/
  59.     QMap<QString, QString> collectedFiles;
  60.     /*! Reference to the preferences */
  61.     PrefsContext* dirs;
  62.  
  63.     /*! Ask user for output directory via GUI.
  64.     \retval true on success */
  65.     bool newDirDialog();
  66.     /*! Check permissions and export document itself.
  67.     \retval true on success */
  68.     bool collectDocument();
  69.     /*! Collect all related items, esp. images.
  70.     \retval true on success */
  71.     bool collectItems();
  72.     /*! Processes the item, helper function for collectItems() */
  73.     void processItem(PageItem *ite);
  74.     /*! Collect used fonts if requested.
  75.     \retval true on success */
  76.     bool collectFonts();
  77.     /*! Helper function for collectFonts() */
  78.     QStringList findFontMetrics(const QString& baseDir, const QString& baseName) const;
  79.     /*! Collect used profiles if requested.
  80.     \retval true on success */
  81.     bool collectProfiles();
  82.     /*! \brief Copy used file into new location with magic checks.
  83.     It looks into collectedFiles map. If there is newFile (key) already
  84.     found - it will construct new filename to prevent overwriting.
  85.     E.g. newFile.png can be newFile_0.png.
  86.     It checks already collected files not to collect one item 2 times.
  87.     \param oldFile full path of the original file
  88.     \param newFile suggested fullpath of the collected file
  89.     \retval QString really used fullpath of the new file
  90.     */
  91.     QString collectFile(QString oldFile, QString newFile);
  92.  
  93. };
  94.  
  95. #endif
  96.